package fcc.Seng462project.client;


import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
/*
*This class extends dialogbox class
*it will spimly create a dialog that has username textbox
*   and password textbox
* it also contain two buttons which is confirm button and cancel button
*/
public class EditDialog extends DialogBox{
	
	
	
	public final Button confirmButton=new Button("Confirm");
	private final Button cancelButton=new Button("Cancel");
	public final TextBox phonenumberBox=new TextBox();
	public final TextBox nameBox=new TextBox();
	public final FlexTable layout=new FlexTable();
	public final Label nameLabel=new Label();
	public final Label phonenumberLabel=new Label();
	
	public EditDialog(){
		layout.setWidget(0, 0, nameLabel);
		layout.setWidget(0, 1, nameBox);
		
		layout.setWidget(1, 0, phonenumberLabel);
		layout.setWidget(1,1,phonenumberBox);
		
		layout.setWidget(2,1,cancelButton);
		layout.setWidget(2,2,confirmButton);
		
		
		layout.getFlexCellFormatter().setColSpan(0, 1, 2);
		layout.getFlexCellFormatter().setColSpan(1, 1, 2);
		
		setWidget(layout);
		/*cancel button actionListener to hide this dialog */
		cancelButton.addClickHandler(new ClickHandler(){
			public void onClick(ClickEvent event){
				Cancel();
			}
		});
		
	}
	/*set up username and password textbox empty*/
	public void Cancel(){
		nameBox.setText("");
		phonenumberBox.setText("");
		hide();
	}
}